<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        a{
            cursor: pointer;
        }
    </style>
</head>
<body>
<input type="text" id="keyword">
<button id="btn">搜索</button>
<table width="500" border="1" style="border-collapse: collapse">
    <thead>
        <th>编号</th>
        <th>名字</th>
        <th>年龄</th>
        <th>操作</th>
    </thead>
    <tbody>
    <tr>
        <td>1</td>
        <td>张三</td>
        <td>10</td>
        <td><a>删除</a></td>
    </tr>
    <tr>
        <td>2</td>
        <td>李四</td>
        <td>11</td>
        <td><a>删除</a></td>
    </tr>
    <tr>
        <td>3</td>
        <td>张四</td>
        <td>12</td>
        <td><a>删除</a></td>
    </tr>
    <tr>
        <td>4</td>
        <td>王五</td>
        <td>13</td>
        <td><a>删除</a></td>
    </tr>
    <tr>
        <td>5</td>
        <td>Bucky</td>
        <td>10</td>
        <td>
            <a>删除</a>
        </td>
    </tr>
    </tbody>
</table>
<script type="text/javascript">
   var oTxt = document.getElementById('keyword');
   var oBtn = document.getElementById('btn');
   var aA =document.getElementsByTagName('a');
   var oTable = document.getElementsByTagName('table')[0];
   var aRows = oTable.tBodies[0].rows;

   //搜索
   oBtn.onclick = function () {

       for(var i=0;i<aRows.length;i++){

           var sTxt = oTxt['value'].toLocaleLowerCase();
           var sTab = aRows[i].cells[1].innerHTML.toLocaleLowerCase();

           var aTxt = sTxt.split('');
           for(var j=0;j<aTxt.length;j++){

               if (sTab.search(aTxt[j])!=-1){
                   aRows[i].style.background = 'red'
               }
           }



       }
   }
   





</script>
</body>
</html>